package ginserver

import (
	"resource_web/ginx/gorms"
	"resource_web/ginx/routers"
)

func Server() {
	/*	logfile, err := os.Create("./gin_http.log")
		if err != nil {
			fmt.Println("Could not create log file")
		}
		gin.SetMode(gin.DebugMode)
		gin.DefaultWriter = io.MultiWriter(logfile)*/
	gorms.OrmConnection()
	gorms.GormData.AutoMigrate()
	router := routers.NewRouter()
	// 设置允许跨域的域名
	// router.Any("/", func(c *gin.Context) {
	// 	c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
	// 	c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
	// 	c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type")
	// 	c.Writer.WriteHeader(http.StatusOK)
	// })

	_ = router.Run("192.168.1.188:8999")

}
